<div class="main devie-detail">
  <div class="main-header">
    <div class="pa-icon-div pull-left fs-14">
      <i class="iconfont icon-shouye fs-14 icon-vertical-top"></i>
      <span class="fs-vertical-middle">工作台>船机设备>设备信息>
      <span class="fs-theme-color">{{vm.name}}</span>
      </span>
    </div>
    <go-back></go-back>
  </div>
  <div class="switch-tabs clear detail-switch" style="margin-top: 2px;">
    <div class="table-item"
      ng-repeat="item in vm.tabData"
      ng-class="{'active': $index == vm.selectedIndex}"
      ng-click="vm.switchTab(item, $index)">{{item.name}}</div>
  </div>
  <div class="main-content worker-base-info" ng-show="vm.selectedIndex === 0">
    <div class="info-item fs0 info-item-other">
      <div class="base-info-fl">
        <img ng-src="{{vm.$getAvatarSrc()}}" alt="">
      </div>
      <div class="base-info-fr">
        <div class="info-item-header fs-16">
          <div class="pa-form-control">
            <label class="pa-form-control-label">设备名称：</label>
            <span class="pa-form-control-span pa-form-header-span">{{vm.deviceDetailInfo.deviceName}}</span>
          </div>
          <div class="pa-form-control">
            <span>（设备编码：</span><span class="fa-theme-color">{{vm.deviceDetailInfo.code}}</span><span>）</span>
          </div>
        </div>
        <div class="pa-form-control w-50 fs-16">
          <label class="fs-theme-color pa-info-label">规格型号</label>
          <span class="pa-form-control-span">{{vm.deviceDetailInfo.model}}</span>
        </div>
        <div class="pa-form-control w-50 fs-16">
          <label class="fs-theme-color pa-info-label">使用部位</label>
          <span class="pa-form-control-span">{{vm.deviceDetailInfo.useLocationName}}</span>
        </div>
        <div class="pa-form-control w-50 fs-16">
          <label class="fs-theme-color pa-info-label">设备分类</label>
          <span class="pa-form-control-span">
            {{vm.getDeviceCategory(vm.deviceDetailInfo.catgegroy)}}
          </span>
        </div>
        <div class="pa-form-control w-50 fs-16">
          <label class="fs-theme-color pa-info-label">使用租赁</label>
          <span class="pa-form-control-span">
            {{vm.deviceDetailInfo.isRent == 1 ? '否' : vm.deviceDetailInfo.isRent == 2 ? '是' : ''}}
          </span>
        </div>
      </div>
    </div>
    <div class="info-item info-item-general clearfix">
      <div class="info-item-header fs-14">
        <label class="info-item-header-label">基本信息</label>
      </div>
      <div class="pa-form-control">
        <label class="fs-theme-color pa-base-info-label">进场时间：</label>
        <span class="pa-form-control-span fs-14">{{vm.deviceDetailInfo.inTime | date:"yyyy-MM-dd"}}</span>
      </div>
      <div class="pa-form-control">
        <label class="fs-theme-color pa-base-info-label">操作责任人：</label>
        <span class="pa-form-control-span fs-14 operator-vertical-top"
          style="padding-top: 6px;">{{vm.deviceDetailInfo.operatorNames}}</span>
      </div>
      <div class="pa-form-control">
        <label class="fs-theme-color pa-base-info-label">检测（验收）：</label>
        <span class="pa-form-control-span fs-14">
          {{vm.deviceDetailInfo.acceptStatus == 1 ? '合格' : vm.deviceDetailInfo.acceptStatus == 2 ? '不合格' : ''}}
        </span>
      </div>
      <div class="pa-form-control">
        <label class="fs-theme-color pa-base-info-label">出场时间：</label>
        <span class="pa-form-control-span fs-14">{{vm.deviceDetailInfo.outTime | date:"yyyy-MM-dd"}}</span>
      </div>
      <div class="pa-form-control">
        <label class="fs-theme-color pa-base-info-label">备注：</label>
        <span class="pa-form-control-span fs-14">{{vm.deviceDetailInfo.remark}}</span>
      </div>
    </div>
    <div class="info-item">
      <div class="info-item-header fs-14">
        <label class="info-item-header-label">附件信息</label>
      </div>
      <div class="file-list">
        <div ng-repeat="file in vm.deviceDetailInfo.files" style="margin: 10px;">
          {{file.fileName}}
          <!-- <button class="pa-btn" type="button">预览</button>
          <button class="pa-btn" type="button">下载</button> -->
          <a class="pa-btn file-del-btn" target="_blank"
            ui-sref="documentPreview({id: file.id})">预览</a>
          <a class="pa-btn file-del-btn" target="_blank"
            ng-href="{{vm.getDownloadSrc(file.id)}}" download="{{file.fileName}}">下载</a>
        </div>
      </div>
    </div>
  </div>
  <div class="main-content" ng-show="vm.selectedIndex === 1">
    <div class="tab-table-brief">检验检测记录
      <div class="fr device-operate fs-theme-color fs-14"
        ng-click="vm.$addCheckDialog(vm)">
        <i class="iconfont icon-dengji icon-middle fs-14"></i>
        <span>检测登记</span>
      </div>
    </div>
    <div class="pa-table-container">
      <table class="pa-table" data-expand-detail>
        <thead>
          <tr>
            <th class="table-text-left">检测时间</th>
            <th>检测结果</th>
            <th>下次检测时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-show="vm.$tableCheck.fetchTimes > 0 &amp;&amp; vm.$tableCheck.pagination.total == 0 &amp;&amp; !vm.$tableCheck.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="4">
              <div>暂无数据</div>
            </td>
          </tr>
          <tr ng-show="vm.$tableTech.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="4">
              <div>数据加载中...</div>
            </td>
          </tr>
          <tr ng-repeat="item in vm.deviceCheckInfo" data-expand>
            <td class="table-text-left table-text-alignment">{{item.checkTime | date:'yyyy-MM-dd'}}</td>
            <td>{{vm.getDeviceCheckResult(item.checkResult)}}</td>
            <td>{{item.nextCheckTime | date:'yyyy-MM-dd'}}</td>
            <td data-hide="附件: ">
              <div class="file-list-folding">
                <div class="file-item" ng-repeat="file in item.files">
                  <span class="file-item-span fl">{{file.fileName}}</span>
                  <a class="pa-btn file-del-btn" target="_blank"
                    ui-sref="documentPreview({id: file.id})">预览</a>
                  <a class="pa-btn file-del-btn" target="_blank"
                    ng-href="{{vm.getDownloadSrc(file.id)}}" download="{{file.fileName}}">下载</a>
                </div>
              </div>
            </td>
            <td>
              <div class="operate-del"
                ng-click="vm.$editCheckDialog(vm, item)">
                <i class="iconfont icon-xiugai1 edit-color fs-12"></i>
                <span>修改</span>
              </div>
              <div class="operate-del" ng-click="vm.$deleteCheck(item.id)">
                <i class="iconfont icon-middle icon-shanchu trash-color fs-12"></i>
                <span>删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
      <div style="margin:20px 0;height:30px;display: inline-block;">共计<span style="color: #008bdd">{{vm.$tableCheck.pagination.totalItems}}</span>条</div>
      <ul uib-pagination
        total-items="vm.$tableCheck.pagination.totalItems"
        items-per-page="vm.$tableCheck.pagination.ITEMS_PER_PAGE"
        ng-model="vm.$tableCheck.pagination.currentPage"
        ng-change="vm.$getDeviceCheck(vm.equipId)"
        max-size="vm.$tableCheck.pagination.maxSize"
        next-text="下一页"
        previous-text="上一页"
        class="pagination-sm pull-right"
        boundary-link-numbers="true"
        rotate="true"
        force-ellipses="true"></ul>
    </div>
  </div>
  <div class="main-content" ng-show="vm.selectedIndex === 2">
    <div class="tab-table-brief">维修保养记录
      <div class="fr device-operate fs-theme-color fs-14"
        ng-click="vm.$addMaintainDialog(vm)">
        <i class="iconfont icon-dengji icon-middle fs-14"></i>
        <span>维保登记</span>
      </div>
    </div>
    <div class="pa-table-container">
      <table class="pa-table" data-expand-detail>
        <thead>
          <tr>
            <th class="table-text-left">维保时间</th>
            <th>维保内容</th>
            <th>下次维保时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-show="vm.$tableMaintain.fetchTimes > 0 &amp;&amp; vm.$tableMaintain.pagination.total == 0 &amp;&amp; !vm.$tableMaintain.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="4">
              <div>暂无数据</div>
            </td>
          </tr>
          <tr ng-show="vm.$tableMaintain.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="4">
              <div>数据加载中...</div>
            </td>
          </tr>
          <tr ng-repeat="item in vm.deviceMaintainInfo" data-expand>
            <td class="table-text-left table-text-alignment">{{item.maintainTime | date:'yyyy-MM-dd'}}</td>
            <td>{{item.maintainContent || '-'}}</td>
            <td>{{item.nextMaintainTime | date:'yyyy-MM-dd'}}</td>
            <td data-hide="附件: ">
              <div class="file-list-folding">
                <div class="file-item" ng-repeat="file in item.files">
                  <span class="file-item-span fl">{{file.fileName}}</span>
                  <a class="pa-btn file-del-btn" target="_blank"
                    ui-sref="documentPreview({id: file.id})">预览</a>
                  <a class="pa-btn file-del-btn" target="_blank"
                    ng-href="{{vm.getDownloadSrc(file.id)}}" download="{{file.fileName}}">下载</a>
                </div>
              </div>
            </td>
            <td>
              <div class="operate-del"
                ng-click="vm.$editMaintainDialog(vm, item)">
                <i class="iconfont icon-xiugai1 edit-color fs-12"></i>
                <span>修改</span>
              </div>
              <div class="operate-del" ng-click="vm.$deleteMaintain(item.id)">
                <i class="iconfont icon-middle icon-shanchu trash-color fs-12"></i>
                <span>删除</span>
              </div>
            </td>
            <!-- <td expand-name="附件名" expand-value="item.files">
              <div class="text-left" ng-repeat="file in item.files">
                <span>{{file.fileName}}</span>
                <button class="pa-sm-btn" ng-click="vm.method.downLoad(value)">下载</button>
                <button class="pa-sm-btn reset-btn" ng-click="vm.method.preview(value)">预览</button>
              </div>
            </td> -->
          </tr>
        </tbody>
      </table>
      <div style="margin:20px 0;height:30px;display: inline-block;">共计<span style="color: #008bdd">{{vm.$tableMaintain.pagination.totalItems}}</span>条</div>
      <ul uib-pagination
        total-items="vm.$tableMaintain.pagination.totalItems"
        items-per-page="vm.$tableMaintain.pagination.ITEMS_PER_PAGE"
        ng-model="vm.$tableMaintain.pagination.currentPage"
        ng-change="vm.$getDeviceMaintain(vm.equipId)"
        max-size="vm.$tableMaintain.pagination.maxSize"
        next-text="下一页"
        previous-text="上一页"
        class="pagination-sm pull-right"
        boundary-link-numbers="true"
        rotate="true"
        force-ellipses="true"></ul>
    </div>
  </div>
  <div class="main-content" ng-show="vm.selectedIndex === 3">
    <div class="tab-table-brief">进出场记录</div>
    <div class="pa-table-container">
      <table class="pa-table">
        <thead>
          <tr>
            <th>分类</th>
            <th>时间</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-show="vm.$tableInOut.fetchTimes > 0 &amp;&amp; vm.$tableInOut.pagination.total == 0 &amp;&amp; !vm.$tableInOut.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="6">
              <div>暂无数据</div>
            </td>
          </tr>
          <tr ng-show="vm.$tableInOut.isTableLoading" class="ng-scope ng-hide" aria-hidden="true">
            <td colspan="6">
              <div>数据加载中...</div>
            </td>
          </tr>
          <tr ng-repeat="item in vm.deviceInOutInfo track by $index">
            <td>{{item.recordType == 1 ? '进场' : item.recordType == 2 ? '出场' : '-'}}</td>
            <td>{{item.recordTime | date:'yyyy-MM-dd'}}</td>
          </tr>
        </tbody>
      </table>
      <div style="margin:20px 0;height:30px;display: inline-block;">共计<span style="color: #008bdd">{{vm.$tableInOut.pagination.totalItems}}</span>条</div>
      <ul uib-pagination
        total-items="vm.$tableInOut.pagination.totalItems"
        items-per-page="vm.$tableInOut.pagination.ITEMS_PER_PAGE"
        ng-model="vm.$tableInOut.pagination.currentPage"
        ng-change="vm.$getDeviceInOut(vm.equipId)"
        max-size="vm.$tableInOut.pagination.maxSize"
        next-text="下一页"
        previous-text="上一页"
        class="pagination-sm pull-right"
        boundary-link-numbers="true"
        rotate="true"
        force-ellipses="true"></ul>
    </div>
  </div>
</div>

<!-- 新增检测记录弹窗 -->
<script type="text/ng-template" id="paAddCheckDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>新增检测记录</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center device-detail-operate document-dialog-file">
      <form name="addForm">
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>检测时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="checkTime"
            data-ng-datepicker
            ng-model="vm.reqData.checkTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>下次检测时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="nextCheckTime"
            data-ng-datepicker
            ng-model="vm.reqData.nextCheckTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>检测结果：</label>
          <select class="form-control-select"
            ng-model="vm.reqData.checkResult">
            <option value="1">合格</option>
            <option value="2">不合格</option>
          </select>
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right">附件：</label>
          <div class="pa-operate-add fs-14 fs-theme-color dialog-file-btn">
            <a class="pa-btn-a"
              attachment-uploader
              data-url="/api/v1/common/uploadFile?folderName=device"
              data-target=".file-list"
              ng-model="vm.view.attachmentFiles">
              <span>上传附件</span>
            </a>
          </div>
          <div class="file-list" style="min-height: 30px;">
            <div class="upload-result">
              <div class="result-item" ng-repeat="file in vm.view.attachmentFiles">
                <span class="file-name">{{file.name}}</span>
                <span>{{file.humanSize}}</span>
                <i class="fa fa-times-circle file-remove-btn" ng-click="$removeFile(file);"></i>
                <span ng-if="file.success === false">上传失败</span>
                <progress ng-if="file.isUploading" class="progress-bar" value="{{file.loaded}}" max="{{file.size}}"></progress>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitForm(addForm)">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>

<!-- 编辑检测记录弹窗 -->
<script type="text/ng-template" id="paEditCheckDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>修改检测记录</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center device-detail-operate document-dialog-file">
      <form name="editForm">
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>检测时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" name="checkTime" class="form-control-input date-picker"
            data-ng-datepicker
            ng-model="vm.checkData.checkTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>下次检测时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" name="nextCheckTime" class="form-control-input date-picker"
            data-ng-datepicker
            ng-model="vm.checkData.nextCheckTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>检测结果：</label>
          <select class="form-control-select"
            ng-model="vm.checkData.checkResult">
            <option value="1">合格</option>
            <option value="2">不合格</option>
          </select>
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right">附件：</label>
          <div class="pa-operate-add fs-14 fs-theme-color dialog-file-btn">
            <a class="pa-btn-a"
              attachment-uploader
              data-url="/api/v1/common/uploadFile?folderName=device"
              data-target=".file-list"
              ng-model="vm.view.attachmentFiles">
              <span>上传附件</span>
            </a>
          </div>
          <div class="file-list" style="min-height: 30px;">
            <div class="upload-result">
              <div class="result-item" ng-repeat="file in vm.view.attachmentFiles">
                <span class="file-name">{{file.name}}</span>
                <span>{{file.humanSize}}</span>
                <i class="fa fa-times-circle file-remove-btn" ng-click="$removeFile(file);"></i>
                <span ng-if="file.success === false">上传失败</span>
                <progress ng-if="file.isUploading" class="progress-bar" value="{{file.loaded}}" max="{{file.size}}"></progress>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitEditForm(editForm)">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>

<!-- 新增维保记录弹窗 -->
<script type="text/ng-template" id="paAddMaintainDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>新增维保记录</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center device-detail-operate document-dialog-file">
      <form name="addForm">
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>维保时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="maintainTime"
            data-ng-datepicker
            ng-model="vm.reqData.maintainTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>下次维保时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="nextMaintainTime"
            data-ng-datepicker
            ng-model="vm.reqData.nextMaintainTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>维保内容：</label>
          <textarea class="form-control-textarea" ng-model="vm.reqData.maintainContent"></textarea>
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right">附件：</label>
          <div class="pa-operate-add fs-14 fs-theme-color dialog-file-btn">
            <a class="pa-btn-a"
              attachment-uploader
              data-url="/api/v1/common/uploadFile?folderName=device"
              data-target=".file-list"
              ng-model="vm.view.attachmentFiles">
              <span>上传附件</span>
            </a>
          </div>
          <div class="file-list" style="min-height: 30px;">
            <div class="upload-result">
              <div class="result-item" ng-repeat="file in vm.view.attachmentFiles">
                <span class="file-name">{{file.name}}</span>
                <span>{{file.humanSize}}</span>
                <i class="fa fa-times-circle file-remove-btn" ng-click="$removeFile(file);"></i>
                <span ng-if="file.success === false">上传失败</span>
                <progress ng-if="file.isUploading" class="progress-bar" value="{{file.loaded}}" max="{{file.size}}"></progress>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitForm(addForm)">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>

<!-- 编辑维保记录弹窗 -->
<script type="text/ng-template" id="paEditMaintainDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>修改资料</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center device-detail-operate document-dialog-file">
      <form name="editForm">
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>维保时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="maintainTime"
            data-ng-datepicker
            ng-model="vm.maintainData.maintainTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>下次维保时间：</label>
          <input type="text" class="hidden-input" autofocus="true">
          <input type="text" class="form-control-input date-picker"
            name="nextMaintainTime"
            data-ng-datepicker
            ng-model="vm.maintainData.nextMaintainTime">
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right"><b>*</b>维保内容：</label>
          <textarea class="form-control-textarea" ng-model="vm.maintainData.maintainContent"></textarea>
        </div>
        <div class="pa-form-control pa-width-100">
          <label class="text-right">附件：</label>
          <div class="pa-operate-add fs-14 fs-theme-color dialog-file-btn">
            <a class="pa-btn-a"
              attachment-uploader
              data-url="/api/v1/common/uploadFile?folderName=device"
              data-target=".file-list"
              ng-model="vm.view.attachmentFiles">
              <span>上传附件</span>
            </a>
          </div>
          <div class="file-list" style="min-height: 30px;">
            <div class="upload-result">
              <div class="result-item" ng-repeat="file in vm.view.attachmentFiles">
                <span class="file-name">{{file.name}}</span>
                <span>{{file.humanSize}}</span>
                <i class="fa fa-times-circle file-remove-btn" ng-click="$removeFile(file);"></i>
                <span ng-if="file.success === false">上传失败</span>
                <progress ng-if="file.isUploading" class="progress-bar" value="{{file.loaded}}" max="{{file.size}}"></progress>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitEditForm(editForm)">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>